﻿<navigation:Page 
    xmlns:inputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input"  
    xmlns:Toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    x:Class="ibba.src.norisk.PageTetoMitigacao"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:src="clr-namespace:ibba.src.norisk" 
	xmlns:slc="clr-namespace:ibba.src.slcomponentes;assembly=ibba.src.slcomponentes"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	mc:Ignorable="d" Background="#FFFBFBFB"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    d:DesignWidth="800"
    d:DesignHeight="600"
    Title="Teto Mitigação">

    <UserControl.Resources>
        <src:ConverterUsaProcessamento x:Key="BackgroundUP" />
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Background="#FFFFFFFF" Margin="0">
        <Toolkit:BusyIndicator x:Name="activity">
            <Grid x:Name="gridContent">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition />
                </Grid.RowDefinitions>

                <Grid x:Name="gridCabecalho" Grid.Row="0" Background="#FF5C7590">
                    <!-- Pesquisa -->
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>

                    <StackPanel Orientation="Horizontal" Grid.Column="0">
                        <Border CornerRadius="10" Background="#FFDEDEDE" MinWidth="100" Margin="5,5">
                            <TextBlock Text="Buscar" Foreground="#FF14517B" Margin="10,0,0,0" VerticalAlignment="Center" />
                        </Border>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Grid.Column="1">
                        <StackPanel Orientation="Horizontal" Margin="10,0">
                            <TextBlock Text="Instrumento:" HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="Verdana" FontSize="11" Foreground="Yellow" />
                            <ComboBox HorizontalAlignment="Left" VerticalAlignment="Center" MinWidth="50" Margin="10,0" Name="cmbInstrumento" SelectionChanged="cmbInstrumento_Click"/>
                        </StackPanel>

                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Bem:" HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="Verdana" FontSize="11" Foreground="Yellow" />
                            <ComboBox HorizontalAlignment="Left" VerticalAlignment="Center" MinWidth="50" Margin="10,0" Name="cmbBem" SelectionChanged="cmbBem_Click" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Natureza:" HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="Verdana" FontSize="11" Foreground="Yellow" />
                            <ComboBox HorizontalAlignment="Left" VerticalAlignment="Center" MinWidth="50" Margin="10,0" Name="cmbNatureza"/>
                        </StackPanel>

                        <StackPanel Orientation="Horizontal">
                            <Button Name="btnPesquisar" Click="btnPesquisar_Click" Height="28">
                                <StackPanel Orientation="Vertical">
                                    <Image Source="../image/search.png" Width="20" HorizontalAlignment="Left" Margin="5,1,0,7" />
                                    <TextBlock Text="Pesquisar" Margin="35,-25,8,0" FontSize="12"/>
                                </StackPanel>
                            </Button>
                        </StackPanel>
                    </StackPanel>

                    <Image Source="../image/etq_confidencial_restrita.png" Width="160" Height="40" Grid.Column="2" Margin="2,0" />
                </Grid>

                <Grid x:Name="gridDetalhe" Grid.Row="1" Margin="7,8,7,0">
                    <!-- Campos / Data Grid-->
                    <TextBlock 
                        Name="txtTetoMitigacao"
        	            FontSize="14"
        	            Foreground="#FFC4991C"        	            
        	            VerticalAlignment="Top" Width="Auto" 
        	            HorizontalAlignment="Left" FontFamily="Verdana" d:LayoutOverrides="GridBox" Margin="0,44,0,0" 
				    />

                    <data:DataGrid x:Name ="grdTetoMitigacao" 
        	            RenderTransformOrigin="0.5,0.5" 
        	            Visibility="Visible" 
        	            AlternatingRowBackground="#FFFCFCFC" 
        	            RowBackground="#FFFCFCFC" 
        	            AutoGenerateColumns="False"  
                        LoadingRow="grdTetoMitigacao_LoadingRow" 
        	            BorderBrush="#FFF8F8F8"
          	            HorizontalScrollBarVisibility="Hidden"
                        ItemsSource="{Binding}" Margin="0,65">
                        <data:DataGrid.Columns>
                            <data:DataGridTextColumn Header="Instrumento" Binding="{Binding DscInstrumento}" Width="200" IsReadOnly="True"/>
                            <data:DataGridTextColumn Header="Bem" Binding="{Binding DscBem}" Width="130" IsReadOnly="True" />
                            <data:DataGridTextColumn Header="Natureza" Binding="{Binding DscNatureza}" Width="130" IsReadOnly="True"/>
                            <data:DataGridTemplateColumn Header="Transfere">
                                <data:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <ComboBox x:Name="cboTransfere" SelectionChanged="cboTransfere_SelectionChanged" />
                                    </DataTemplate>
                                </data:DataGridTemplateColumn.CellTemplate>
                            </data:DataGridTemplateColumn>
                            <data:DataGridTextColumn Header="HE(%)" Binding="{Binding PercHE, Mode=TwoWay}" MinWidth="63" IsReadOnly="False"/>
                            <data:DataGridTextColumn Header="HV(%)" Binding="{Binding PercHV, Mode=TwoWay}" MinWidth="63" IsReadOnly="False"/>
                            <data:DataGridTextColumn Header="LMM(%)" Binding="{Binding PercLMM, Mode=TwoWay}" MinWidth="68" IsReadOnly="False"/>
                            <data:DataGridTemplateColumn Header="Utilizar" Width="90" IsReadOnly="True">
                                <data:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <ComboBox  x:Name="cboUtilizar" SelectionChanged="cboUtilizar_SelectionChanged"/>
                                    </DataTemplate>
                                </data:DataGridTemplateColumn.CellTemplate>
                            </data:DataGridTemplateColumn>
                            <data:DataGridTemplateColumn Header="Verificar Rating para transferência" IsReadOnly="True">
                                <data:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <ComboBox x:Name="cboRating" SelectionChanged="cboRating_SelectionChanged"/>
                                    </DataTemplate>
                                </data:DataGridTemplateColumn.CellTemplate>
                            </data:DataGridTemplateColumn>
                        </data:DataGrid.Columns>
                    </data:DataGrid>
                </Grid>
            </Grid>
        </Toolkit:BusyIndicator>
    </Grid>

</navigation:Page>